package com.lin.cloud.disk.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.lin.cloud.disk.entity.pojo.DepartmentPermission;
import com.lin.cloud.disk.service.IDepartmentPermissionService;
import com.lin.cloud.disk.mapper.DepartmentPermissionMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (DepartmentPermission)表服务实现类
 *
 * @author ljc
 * @since 2020-12-10 16:47:09
 */
@Service
@Slf4j
public class DepartmentPermissionServiceImpl implements IDepartmentPermissionService {

    @Resource
    private DepartmentPermissionMapper departmentPermissionMapper;


    /**
     * 查询权限ID列表 通过部门ID列表
     * @param departmentIdList
     * @return
     */
    @Override
    public List<Long> selectPermissionIdListByDepartmentIdList(List<Long> departmentIdList) {
        return departmentPermissionMapper.selectPermissionIdListByDepartmentIdList(departmentIdList);
    }

    /**
     *  批量添加部门授权记录
     * @param departmentPermissionList
     */
    @Override
    public void batchInsertDepartmentPermission(List<DepartmentPermission> departmentPermissionList){
        if (CollectionUtil.isNotEmpty(departmentPermissionList)){
             departmentPermissionMapper.batchInsertDepartmentPermission(departmentPermissionList);
        }
    }

    /**
     *  批量删除部门授权记录
     * @param departmentPermissionIdList
     */
    @Override
    public void batchDeleteDepartmentPermission(Long departmentId, List<Long> departmentPermissionIdList){
        if (CollectionUtil.isNotEmpty(departmentPermissionIdList)){
            departmentPermissionMapper.batchDeleteDepartmentPermission(departmentId,departmentPermissionIdList);
        }
    }
}